package com.playball.lottery;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Timer;
import java.util.TimerTask;

import android.text.TextUtils;

import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
import com.playball.lottery.customview.BallDTO;
import com.playball.lottery.customview.ChildDTO;
import com.playball.lottery.customview.HomeCenterLayout;
import com.playball.lottery.eventmanger.EventManager;
import com.playball.lottery.eventmanger.EventType;
import com.playball.lottery.util.FrmWorkStatus;
import com.playball.lottery.util.LotInfo;

/**
 * 单利类，代替application存储全局数据，避免做成插件包时的冲突
 * @author sunfanglei
 * @date 2013年10月9日
 */

public class ApplicationData {

	
	public static String APPVERSION = "2.0.2";
	
	private static final ApplicationData singleInstance = new ApplicationData();
	
	public static FrmWorkStatus FRM_WORK_STATUS;
	public static int HomeCenterLayout_Position;
	public static boolean HomeBannerShow;
	
	
	public static final String[] LUCKY_ARRSELLOT = new String[] {"双色球","大乐透","11选5","十一运夺金","重庆时时彩","快三","福彩3D","七乐彩","排列3","排列5","七星彩"};
	
	public static final String[] LUCKY_ARRSELTYPE = new String[]{"星座","属相","生日","姓名"};
	
	public static final String[]  LUCKY_ARRSELNUM =new String[]{"1注","2注","3注","4注","5注","6注","7注","8注","9注","10注"};
	
	/**
	 * 用户名
	 */
	private String userName = "";
	
	/**
	 * 用户密码
	 */
	private String userPassWord;
	
	/**
	 * 用户ID
	 */
	private String userId;
	
	/**
	 * 用户余额
	 */
	private String userMoney;
	
	/**
	 * 注册时间
	 */
	private String RegisterTime;
	
	/**
	 * 推广版本号
	 */
	private int CommenderID = 0;
	
	/**
	 * 推广版本名
	 */
	private String CommenderName;
	
	/**
	 * 绑定卡id
	 */
	private String bandID;

	public int getCommenderID() {
		return CommenderID;
	}

	public void setCommenderID(int commenderID) {
		CommenderID = commenderID;
	}
	
	public String getCommenderName() {
		return CommenderName;
	}

	public void setCommenderName(String commenderName) {
		CommenderName = commenderName;
	}

	/**
	 * 大乐透选号列表 追加checkbox 是否被选中
	 */
	private Boolean isDLTZhuiJiaClick;

	public Boolean getIsDLTZhuiJiaClick() {
		return isDLTZhuiJiaClick;
	}

	public void setIsDLTZhuiJiaClick(Boolean isDLTZhuiJiaClick) {
		this.isDLTZhuiJiaClick = isDLTZhuiJiaClick;
	}

	private ApplicationData() {
		// TODO Auto-generated constructor stub
		init();
	}

	public static ApplicationData getInstance(){
    	return singleInstance;
    }
	
//	public LotInfo ssq;
//	public LotInfo dlt;
//	public LotInfo elex5;
//	public LotInfo jczq;
	
	public List<Map<String, Object>> KjData = null;
	
	public List<Map<String, Object>> LotInfoStatus = null;
	
	  /**
     * 
     */
    private static final long serialVersionUID = 1L;

    /**
     * 全局变量，该类在某一个Activity中改变了这些全局变量的值，那么在同一个应用的其他Activity中值就会改变。
     */

    //个人信息
    private String realName = ""; 		//真实姓名
    private String mobile = ""; 			//手机
    private String cardNum = "";		//银行卡号
    private String bankName = "";	//开户银行
    //add by tanglizhong
    private String IDCardNumber = "";				//身份证
    private boolean IsMobileValied = false;		//手机是否验证 
    //安全问题
    private String SecurityQuestion = "";
    //是否已设置支付密码，1：是，0：否
    private int IsPayPwd;
    private int bankId;
    
    // 双色球列表
    private ArrayList<BallDTO> list_ssqdto;
    private int all_ssqmoney;

    // 大乐透列表
    private ArrayList<BallDTO> list_dltdto;
    private int all_dltmoney;

    // 11选5列表
    private ArrayList<BallDTO> list_11x5dto;
    private int all_11x5money;
    private int play_11x5Id;
    
    // 重庆时时彩列表
    private ArrayList<BallDTO> list_cqsscdto;
    private int all_cqsscmoney;
    private int play_cqsscId;
    private String play_cqssctype;

    //排列3列表
    private ArrayList<BallDTO> list_pl3dto;
    private int all_pl3money;
    private int play_pl3Id;
    
    //排列5列表
    private ArrayList<BallDTO> list_pl5dto;
    private int all_pl5money;
    private int play_pl5Id;
//    // 竞彩足球
//    private ArrayList<ChildDTO> list_jcdto;
//    private int all_jcmoney;
    // 总金额

    // 双色球列表
    private int red_count;
    private int blue_count;
    private int dlt_red_count;
    private int dlt_blue_count;

    private String loginName;
    private String loginPwd;
    /**保存登录时返回的userId进全局变量*/
    public static String UserID="";
	/**底部菜单栏高度*/
    
    
    private int tabHostHeight; 

    public int getTabHostHeight() {
		return tabHostHeight;
	}

	public void setTabHostHeight(int tabHostHeight) {
		this.tabHostHeight = tabHostHeight;
	}

	
	public void  init(){
		userId = null;
//		ssq = new LotInfo();
//		dlt = new LotInfo();
//		elex5 = new LotInfo();
//		jczq = new LotInfo();
		KjData = new ArrayList<Map<String,Object>>();
		LotInfoStatus = new ArrayList<Map<String,Object>>();
		resetJCData();
		// 初始化选号
		initList();
		setLoginName("");
		setLoginPwd("");
		setUserID("");

	}
	
	public void setLotInfo(List<Map<String, Object>> data){
		LotInfoStatus = data;
	}
	
	public List<Map<String, Object>> getLotInfoStatus(){
		return LotInfoStatus;
	}
	
	public TimerTask task;
	public Timer timer;
	private boolean isRunTask = false;
	public void startTimerTaskPerS(){
		if(isRunTask == false){
			timer = new Timer(false);
			task = new TimerTask() {
					@Override
					public void run() {
						// TODO Auto-generated method stub
						EventManager.getInstance().onEvent(EventType.EV_DAL_ONESECOND_TASK_COUNT_DOWN, null);
					}
				};
			timer.schedule(task, 0, 1000);
			isRunTask = true;
		}
	}
	public void stopTimerTaskPerS(){
		isRunTask = false;
		if(timer != null) {
			timer.cancel();
			task.cancel();
		}
	}
	
	/**
	 * 获取用户登录状态
	 * @return true-登录   false未登录 
	 */
	public boolean isUserLogin(){
		return TextUtils.isEmpty(userId) ? false : true;
	}
	
	public String getUserName(){
		return //"超级用户";
		userName;
	}
	
	public void setUserName(String un){
		userName = un;
	}
	
	public String getUserPassword(){
		return userPassWord;
	}
	
	public void setUserPassword(String password){
		userPassWord = password;
	}
	
	public String getUserID(){
		return userId;
	}
	
	public void setUserID(String id){
		userId = id;
	}
	
	public String getUserMoney(){
		return userMoney;
	}
	
	public void setUserMoney(String money){
		userMoney = money;
	}
	
	
	public void resetJCData(){
		list_jcdto = new ArrayList<ChildDTO>();
		setList_jcdto(list_jcdto);
		setAll_jcmoney(0);
	}
	
    // 竞彩足球
    private ArrayList<ChildDTO> list_jcdto;
    private int all_jcmoney;
    public ArrayList<ChildDTO> getList_jcdto() {
	return list_jcdto;
    }

    public void setList_jcdto(ArrayList<ChildDTO> list_jcdto) {
	this.list_jcdto = list_jcdto;
    }
    public int getAll_jcmoney() {
	return all_jcmoney;
    }

    public void setAll_jcmoney(int all_jcmoney) {
	this.all_jcmoney = all_jcmoney;
    }
    
    
    // 初始化选号
    public void initList() {
	list_ssqdto = new ArrayList<BallDTO>();
	setList_ssqdto(list_ssqdto);
	setRed_count(6);
	setBlue_count(1);
	setAll_ssqmoney(0);

	list_dltdto = new ArrayList<BallDTO>();
	setList_dltdto(list_dltdto);
	setDlt_red_count(5);
	setDlt_blue_count(2);
	setAll_dltmoney(0);

	list_11x5dto = new ArrayList<BallDTO>();
	setList_11x5dto(list_11x5dto);
	setPlay_11x5Id(0);
	setAll_11x5money(0);
	
	list_cqsscdto = new ArrayList<BallDTO>();
	setList_cqsscdto(list_cqsscdto);
	setPlay_cqsscId(0);
	setAll_cqsscmoney(0);
	setPlay_cqssctype("");
	
	list_pl3dto = new ArrayList<BallDTO>();
	setList_pl3dto(list_pl3dto);
	setPlay_pl3Id(0);
	setAll_pl3money(0);
	
	list_pl5dto = new ArrayList<BallDTO>();
	setList_pl5dto(list_pl5dto);
	setPlay_pl5Id(0);
	setAll_pl5money(0);

//	list_jcdto = new ArrayList<ChildDTO>();
//	setList_jcdto(list_jcdto);
//	setAll_jcmoney(0);
    }

    public int getDlt_red_count() {
	return dlt_red_count;
    }

    public void setDlt_red_count(int dlt_red_count) {
	this.dlt_red_count = dlt_red_count;
    }

    public ArrayList<BallDTO> getList_ssqdto() {
	return list_ssqdto;
    }

    public void setList_ssqdto(ArrayList<BallDTO> list_ssqdto) {
	this.list_ssqdto = list_ssqdto;
    }

    public ArrayList<BallDTO> getList_dltdto() {
	return list_dltdto;
    }

    public void setList_dltdto(ArrayList<BallDTO> list_dltdto) {
	this.list_dltdto = list_dltdto;
    }

    public int getRed_count() {
	return red_count;
    }

    public void setRed_count(int red_count) {
	this.red_count = red_count;
    }

    public int getBlue_count() {
	return blue_count;
    }

    public void setBlue_count(int blue_count) {
	this.blue_count = blue_count;
    }

    public ArrayList<BallDTO> getList_11x5dto() {
	return list_11x5dto;
    }

    public void setList_11x5dto(ArrayList<BallDTO> list_11x5dto) {
	this.list_11x5dto = list_11x5dto;
    }
    
    public ArrayList<BallDTO> getList_cqsscdto() {
	return list_11x5dto;
    }

    public void setList_cqsscdto(ArrayList<BallDTO> list_cqsscdto) {
	this.list_cqsscdto = list_cqsscdto;
    }
    
    public ArrayList<BallDTO> getList_pl3dto() {
	return list_pl3dto;
    }

    public void setList_pl3dto(ArrayList<BallDTO> list_pl3dto) {
	this.list_pl3dto = list_pl3dto;
    }

    public ArrayList<BallDTO> getList_pl5dto() {
		return list_pl5dto;
	}

	public void setList_pl5dto(ArrayList<BallDTO> list_pl5dto) {
		this.list_pl5dto = list_pl5dto;
	}

	public int getAll_pl5money() {
		return all_pl5money;
	}

	public void setAll_pl5money(int all_pl5money) {
		this.all_pl5money = all_pl5money;
	}

	public int getPlay_pl5Id() {
		return play_pl5Id;
	}

	public void setPlay_pl5Id(int play_pl5Id) {
		this.play_pl5Id = play_pl5Id;
	}

	public String getLoginName() {
	return loginName;
    }

    public void setLoginName(String loginName) {
	this.loginName = loginName;
    }

    public String getLoginPwd() {
	return loginPwd;
    }

    public void setLoginPwd(String loginPwd) {
	this.loginPwd = loginPwd;
    }

    public int getDlt_blue_count() {
	return dlt_blue_count;
    }

    public void setDlt_blue_count(int dlt_blue_count) {
	this.dlt_blue_count = dlt_blue_count;
    }

//    public ArrayList<ChildDTO> getList_jcdto() {
//	return list_jcdto;
//    }
//
//    public void setList_jcdto(ArrayList<ChildDTO> list_jcdto) {
//	this.list_jcdto = list_jcdto;
//    }

    public int getAll_ssqmoney() {
	return all_ssqmoney;
    }

    public void setAll_ssqmoney(int all_ssqmoney) {
	this.all_ssqmoney = all_ssqmoney;
    }

    public int getAll_dltmoney() {
	return all_dltmoney;
    }

    public void setAll_dltmoney(int all_dltmoney) {
	this.all_dltmoney = all_dltmoney;
    }

    public int getAll_11x5money() {
	return all_11x5money;
    }

    public void setAll_11x5money(int all_11x5money) {
	this.all_11x5money = all_11x5money;
    }
    
    public int getAll_cqsscmoney() {
	return all_cqsscmoney;
    }

    public void setAll_cqsscmoney(int all_cqsscmoney) {
	this.all_cqsscmoney = all_cqsscmoney;
    }
    
    public int getAll_pl3money() {
	return all_pl3money;
    }

    public void setAll_pl3money(int all_pl3money) {
	this.all_pl3money = all_pl3money;
    }

//    public int getAll_jcmoney() {
//	return all_jcmoney;
//    }
//
//    public void setAll_jcmoney(int all_jcmoney) {
//	this.all_jcmoney = all_jcmoney;
//    }

    public int getPlay_11x5Id() {
	return play_11x5Id;
    }

    public void setPlay_11x5Id(int play_11x5Id) {
	this.play_11x5Id = play_11x5Id;
    }
    
    public int getPlay_cqsscId() {
	return play_cqsscId;
    }

    public void setPlay_cqsscId(int play_cqsscId) {
	this.play_cqsscId = play_cqsscId;
    }
    
    public int getPlay_pl3Id() {
	return play_pl3Id;
    }

    public void setPlay_pl3Id(int play_pl3Id) {
	this.play_pl3Id = play_pl3Id;
    }
   
    public String getRealName(){
    	return realName;
    }
    
    public void setRealName(String name){
    	realName = name;
    }
    
    public String getMobile(){
    	return mobile;
    }
    
    public void setMobile(String mobile){
    	this.mobile = mobile;
    }
    
    public String getCardNum(){
    	return cardNum;
    }
    
    public void setCardNum(String cardNum){
    	this.cardNum = cardNum;
    }
    
    public String getBankName(){
    	return bankName;
    }
    
    public void setBankName(String bankName){
    	this.bankName = bankName;
    }
    
//    public String getUserID() {
//		return UserID;
//	}
//
//	public void setUserID(String userID) {
//		UserID = userID;
//	}

	public String getPlay_cqssctype() {
		return play_cqssctype;
	}

	public void setPlay_cqssctype(String play_cqssctype) {
		this.play_cqssctype = play_cqssctype;
	}

	public String getIDCardNumber() {
		return IDCardNumber;
	}

	public void setIDCardNumber(String iDCardNumber) {
		IDCardNumber = iDCardNumber;
	}

	public boolean isIsMobileValied() {
		return IsMobileValied;
	}

	public void setIsMobileValied(boolean isMobileValied) {
		IsMobileValied = isMobileValied;
	}

	public String getSecurityQuestion() {
		return SecurityQuestion;
	}

	public void setSecurityQuestion(String securityQuestion) {
		SecurityQuestion = securityQuestion;
	}

	public int getIsPayPwd() {
		return IsPayPwd;
	}

	public void setIsPayPwd(int isPayPwd) {
		IsPayPwd = isPayPwd;
	}

	public int getBankId() {
		return bankId;
	}

	public void setBankId(int bankId) {
		this.bankId = bankId;
	}

	public String getRegisterTime() {
		return RegisterTime;
	}

	public void setRegisterTime(String registerTime) {
		RegisterTime = registerTime;
	}

	public String getBandID() {
		return bandID;
	}

	public void setBandID(String bandID) {
		this.bandID = bandID;
	}
	
}
